package timing.ukulele.common.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;
import java.util.Map;

@Data
public class TaskVO implements Serializable, Comparable<TaskVO>{
    //任务id
    private String id;
    //任务类型: 0待办任务  1已办任务
    private Integer taskType;
    //任务的办理人
    private String taskAssignee;
    //流程实例ID
    private String processInstanceId;
    //执行对象ID
    private String executionId;
    //流程定义ID
    private String processDefinitionId;
    //流程表单
    private String formKey;

    //任务拥有者
    private String owner;
    //执行人更改次数
    private int assigneeUpdatedCount;
    //原始执行人
    private String originalAssignee;
    //实际执行人
    private String assignee;
    //候选人
    private String candidate;

    private String parentTaskId;
    //任务名称
    private String name;
    private String localizedName;
    //任务描述
    private String description;
    private String localizedDescription;
    //流程实例创建时间
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date procinstCreateTime;
    //任务创建时间
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;
    //任务转接时间
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date claimTime;
    //任务结束时间
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date endTime;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date dueDate;
    private String eventName;
    //租户系统id
    private String tenantId;
    //任务指定人类型 0配置 1前端指定
    private String assigneeType;
    //任务配置时的人员集合
    private String configureUsers;
    //任务锁状态
    private Boolean locked;

    //节点自定义参数
    private Map<String, String> properties;


    @Override
    public int compareTo(TaskVO o) {
        if (this.createTime.compareTo(o.getCreateTime()) > 0) {
            return 1;
        } else if (this.createTime.compareTo(o.getCreateTime()) == 0) {
            return 0;
        } else {
            return -1;
        }
    }
}
